package com.knowledgegraph.controller;

import com.knowledgegraph.common.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 健康检查控制器
 * 
 * @author system
 * @since 2024-01-01
 */
@RestController
@RequestMapping("/health")
public class HealthController {

    /**
     * 健康检查
     */
    @PostMapping("/check")
    public Result<Map<String, Object>> health() {
        Map<String, Object> data = new HashMap<>();
        data.put("status", "UP");
        data.put("timestamp", System.currentTimeMillis());
        data.put("service", "知识图谱管理系统");
        data.put("version", "1.0.0");
        
        return Result.success("系统运行正常", data);
    }

    /**
     * 系统信息
     */
    @PostMapping("/info")
    public Result<Map<String, Object>> info() {
        Map<String, Object> data = new HashMap<>();
        data.put("java.version", System.getProperty("java.version"));
        data.put("java.vendor", System.getProperty("java.vendor"));
        data.put("os.name", System.getProperty("os.name"));
        data.put("os.version", System.getProperty("os.version"));
        data.put("user.timezone", System.getProperty("user.timezone"));
        
        return Result.success("系统信息", data);
    }
}